package day20;

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;

import org.junit.Test;

import day17.Student;
import day19.JDBCUtil;

public class DelimiterTest {
	@Test
	public void callableStatementTest() {
		Connection connection = null;
		CallableStatement callableStatement = null;
		ResultSet resultSet = null;
		
		try {
			connection = JDBCUtil.getConnection();
			callableStatement = connection.prepareCall("CALL show_student");
			resultSet = callableStatement.executeQuery();
			while (resultSet.next()) {
				int id = resultSet.getInt("id");
				String name = resultSet.getString("name");
				int age = resultSet.getInt("age");
				String gender = resultSet.getString("gender");
				Student student = new Student(id, name, age, gender);
				System.out.println(student);
			}
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
	}
}
